﻿package {
	import flash.display.Sprite;
	import utils.appli.Case;
	import utils.appli.De;
	import utils.appli.Regle;
	import utils.appli.DeroulementPartie;
	public class MainPlateau extends Sprite {
		
		private var _nbCases:int;
				
		public function MainPlateau() {
			_nbCases=0;
			
			//ligne rond bleu horizontaux
			addChild(new Case(25, 340, "rouge", true));
			addChild(new Case(77.5, 340, "rouge", false));
			addChild(new Case(130, 340, "rouge", false));
			addChild(new Case(182.5, 340, "rouge", false));
			addChild(new Case(235, 340, "rouge", false));
			addChild(new Case(287.5, 340, "rouge", false));
			addChild(new Case(340, 340, "rouge", false));	
			//ligne carre bleu numéroté horizontaux
			addChild(new Case(77.5, 400, "rouge", true));
			addChild(new Case(130, 400, "rouge", true));
			addChild(new Case(182.5, 400, "rouge", true));
			addChild(new Case(235, 400, "rouge", true));
			addChild(new Case(287.5, 400, "rouge", true));
			addChild(new Case(340, 400, "rouge", true));	
			//ligne rond bleu verticaux
			addChild(new Case(340, 287.5, "rouge", false));
			addChild(new Case(340, 235, "rouge", false));
			addChild(new Case(340, 182.5, "rouge", false));
			addChild(new Case(340, 130, "rouge", false));
			addChild(new Case(340, 77.5, "rouge", false));	
			addChild(new Case(340, 25, "rouge", false));
			//dernier rond bleu
			addChild(new Case(400, 25, "rouge", false));
			
			//##############################################
			
			//ligne rond rouge verticaux
			addChild(new Case(460, 25, "vert", true));
			addChild(new Case(460, 77.5, "vert", false));
			addChild(new Case(460, 130, "vert", false));
			addChild(new Case(460, 182.5, "vert", false));
			addChild(new Case(460, 235, "vert", false));
			addChild(new Case(460, 287.5, "vert", false));
			addChild(new Case(460, 340, "vert", false));	
			//ligne carre rouge numéroté verticaux
			addChild(new Case(400, 77.5, "vert", true));
			addChild(new Case(400, 130, "vert", true));
			addChild(new Case(400, 182.5, "vert", true));
			addChild(new Case(400, 235, "vert", true));
			addChild(new Case(400, 287.5, "vert", true));
			addChild(new Case(400, 340, "vert", true));	
			//ligne rond rouge horizontaux	
			addChild(new Case(512.5, 340, "vert", false));
			addChild(new Case(565, 340, "vert", false));
			addChild(new Case(617.5, 340, "vert", false));
			addChild(new Case(670, 340, "vert", false));	
			addChild(new Case(722.5, 340, "vert", false));
			addChild(new Case(775, 340, "vert", false));
			//dernier rond rouge
			addChild(new Case(775, 400, "vert", false));
			
			//##############################################
			
			//ligne rond jaune horizontaux
			addChild(new Case(775, 460, "jaune", true));
			addChild(new Case(722.5, 460, "jaune", false));
			addChild(new Case(670, 460, "jaune", false));	
			addChild(new Case(617.5, 460, "jaune", false));
			addChild(new Case(565, 460, "jaune", false));
			addChild(new Case(512.5, 460, "jaune", false));
			addChild(new Case(460, 460, "jaune", false));		
			//ligne carre jaune numéroté horizontaux
			addChild(new Case(722.5, 400, "jaune", true));
			addChild(new Case(670, 400, "jaune", true));	
			addChild(new Case(617.5, 400, "jaune", true));
			addChild(new Case(565, 400, "jaune", true));
			addChild(new Case(512.5, 400, "jaune", true));
			addChild(new Case(460, 400, "jaune", true));		
			//ligne rond jaune verticaux	
			addChild(new Case(460, 512.5, "jaune", false));
			addChild(new Case(460, 565, "jaune", false));
			addChild(new Case(460, 617.5, "jaune", false));
			addChild(new Case(460, 670, "jaune", false));
			addChild(new Case(460, 722.5, "jaune", false));
			addChild(new Case(460, 775, "jaune", false));
			//dernier rond jaune
			addChild(new Case(400, 775, "jaune", false));
			
			//##############################################
			
			//ligne rond vert verticaux
			addChild(new Case(340, 775, "bleu", true));
			addChild(new Case(340, 722.5, "bleu", false));
			addChild(new Case(340, 670, "bleu", false));	
			addChild(new Case(340, 617.5, "bleu", false));
			addChild(new Case(340, 565, "bleu", false));
			addChild(new Case(340, 512.5, "bleu", false));
			addChild(new Case(340, 460, "bleu", false));
			//ligne carre vert numéroté verticaux
			addChild(new Case(400, 722.5, "bleu", true));
			addChild(new Case(400, 670, "bleu", true));	
			addChild(new Case(400, 617.5, "bleu", true));
			addChild(new Case(400, 565, "bleu", true));
			addChild(new Case(400, 512.5, "bleu", true));
			addChild(new Case(400, 460, "bleu", true));	
			//ligne rond vert horizontaux	
			addChild(new Case(287.5, 460, "bleu", false));
			addChild(new Case(235, 460, "bleu", false));
			addChild(new Case(182.5, 460, "bleu", false));
			addChild(new Case(130, 460, "bleu", false));
			addChild(new Case(77.5, 460, "bleu", false));
			addChild(new Case(25, 460, "bleu", false));
			//dernier rond vert
			addChild(new Case(25, 400, "bleu", false));
			
			/*Ajout du cheval bleu*/
			
			/*var maCase:Case = this.getChildAt(6) as Case;
			maCase.occuper("joueurBleu");
			trace(maCase.isOccupe());*/
			
			addChild(new De());
			addChild(new Regle());			
			addChild(new DeroulementPartie());
			
			/*
			var ancienY = 0;
			for(var i:int = _nbCases; i<this.numChildren; i++) {
				this.getChildAt(i).y = this.getChildAt(i-1).y;
				
				this.getChildAt(i).x = this.getChildAt(i-1).x-(40+12.5);
				_nbCases = i+1;
				ancienY = this.getChildAt(i).y;
			}
			*/
			
		}
		
	}
}
